package algorithms.que14;


import java.util.Arrays;

/**
 * @功能
 * @创建时间 2020/8/29
 */
public class SORT {
    public void getSort(int[] arr){
        Arrays.sort(arr);
        BirmarySearch(arr,5);
    }
    public void BirmarySearch(int[] arr,int i){
        int last = arr.length-1;
        int first =0;
        int middle =first+((last-first)/2) ;
        while (arr[middle]!=i){
            if(arr[middle]<i){
                first=middle+1;
                middle=first+((last-first)/2);
            }else if(arr[middle]>i){
                last=middle-1;
                middle=first+((last-first)/2);
            }else if(arr[middle]==i){
                break;
            }
        }
       System.out.println(middle);
    }
}
class Client{
    public static void main(String[] args) {
        String x = "string";
        String y = "string";
        String z = new String("string");
        System.out.println(x==y);
        System.out.println(x==z);
        System.out.println(x.equals(y));
//        SORT b= new SORT();
//        int[] a={1,2,3,4,5,67,8,56,13,114,14};
//        b.getSort(a);

    }
}
